package org.x.user.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Data;

/**
 * 数据源配置信息表
 * @TableName sys_ds_config
 */
@TableName(value ="sys_ds_config")
@Data
public class SysDsConfig {
    /**
     * 数据源配置ID
     */
    @TableId
    private String id;

    /**
     * 数据源名称
     */
    private String dsName;

    /**
     * 数据源类型
     */
    private Object dsType;

    /**
     * 创建人
     */
    private String createBy;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 修改人
     */
    private String updateBy;

    /**
     * 修改时间
     */
    private Date updateTime;

    /**
     * 所属环境
     */
    private Object envType;

    /**
     * 驱动类
     */
    private String driverClass;

    /**
     * 主库URL
     */
    private String masterUrl;

    /**
     * 从库URL列表
     */
    private Object slaveUrls;

    /**
     * 用户名
     */
    private String username;

    /**
     * 加密后的密码
     */
    private String password;

    /**
     * 负载权重（1-100）
     */
    private Integer weight;

    /**
     * 是否启用
     */
    private Integer isEnabled;

    /**
     * 连接池配置
     */
    private Object poolConfig;

    /**
     * 元数据
     */
    private Object metadata;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        SysDsConfig other = (SysDsConfig) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getDsName() == null ? other.getDsName() == null : this.getDsName().equals(other.getDsName()))
            && (this.getDsType() == null ? other.getDsType() == null : this.getDsType().equals(other.getDsType()))
            && (this.getCreateBy() == null ? other.getCreateBy() == null : this.getCreateBy().equals(other.getCreateBy()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateBy() == null ? other.getUpdateBy() == null : this.getUpdateBy().equals(other.getUpdateBy()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getEnvType() == null ? other.getEnvType() == null : this.getEnvType().equals(other.getEnvType()))
            && (this.getDriverClass() == null ? other.getDriverClass() == null : this.getDriverClass().equals(other.getDriverClass()))
            && (this.getMasterUrl() == null ? other.getMasterUrl() == null : this.getMasterUrl().equals(other.getMasterUrl()))
            && (this.getSlaveUrls() == null ? other.getSlaveUrls() == null : this.getSlaveUrls().equals(other.getSlaveUrls()))
            && (this.getUsername() == null ? other.getUsername() == null : this.getUsername().equals(other.getUsername()))
            && (this.getPassword() == null ? other.getPassword() == null : this.getPassword().equals(other.getPassword()))
            && (this.getWeight() == null ? other.getWeight() == null : this.getWeight().equals(other.getWeight()))
            && (this.getIsEnabled() == null ? other.getIsEnabled() == null : this.getIsEnabled().equals(other.getIsEnabled()))
            && (this.getPoolConfig() == null ? other.getPoolConfig() == null : this.getPoolConfig().equals(other.getPoolConfig()))
            && (this.getMetadata() == null ? other.getMetadata() == null : this.getMetadata().equals(other.getMetadata()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getDsName() == null) ? 0 : getDsName().hashCode());
        result = prime * result + ((getDsType() == null) ? 0 : getDsType().hashCode());
        result = prime * result + ((getCreateBy() == null) ? 0 : getCreateBy().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateBy() == null) ? 0 : getUpdateBy().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getEnvType() == null) ? 0 : getEnvType().hashCode());
        result = prime * result + ((getDriverClass() == null) ? 0 : getDriverClass().hashCode());
        result = prime * result + ((getMasterUrl() == null) ? 0 : getMasterUrl().hashCode());
        result = prime * result + ((getSlaveUrls() == null) ? 0 : getSlaveUrls().hashCode());
        result = prime * result + ((getUsername() == null) ? 0 : getUsername().hashCode());
        result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode());
        result = prime * result + ((getWeight() == null) ? 0 : getWeight().hashCode());
        result = prime * result + ((getIsEnabled() == null) ? 0 : getIsEnabled().hashCode());
        result = prime * result + ((getPoolConfig() == null) ? 0 : getPoolConfig().hashCode());
        result = prime * result + ((getMetadata() == null) ? 0 : getMetadata().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", dsName=").append(dsName);
        sb.append(", dsType=").append(dsType);
        sb.append(", createBy=").append(createBy);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateBy=").append(updateBy);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", envType=").append(envType);
        sb.append(", driverClass=").append(driverClass);
        sb.append(", masterUrl=").append(masterUrl);
        sb.append(", slaveUrls=").append(slaveUrls);
        sb.append(", username=").append(username);
        sb.append(", password=").append(password);
        sb.append(", weight=").append(weight);
        sb.append(", isEnabled=").append(isEnabled);
        sb.append(", poolConfig=").append(poolConfig);
        sb.append(", metadata=").append(metadata);
        sb.append("]");
        return sb.toString();
    }
}